package com.br.negocio.vo;


import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "conta_pagar")
@SequenceGenerator(name = "conta_pagar_seq", sequenceName = "conta_pagar_cod_conta_pagar_seq", allocationSize = 1)
@NamedQueries ({
        @NamedQuery(name = "loadAllContaPagar", query = "from ContaPagarVO c order by c.dataVencimento"),
        @NamedQuery(name = "findContaPagar", query = "from ContaPagarVO as c where c.codigo = :codigo"),
        @NamedQuery(name = "findDuplicatedContaPagar", query = "from ContaPagarVO as c where c.descricao = :descricao")
})
public class ContaPagarVO extends ContaVO implements Serializable {
        
        private static final long serialVersionUID = 1L;
        
        @Id
        @Column(name = "cod_conta_pagar")
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "conta_pagar_seq")
        private Integer codigo;
        
        @Temporal(TemporalType.TIMESTAMP)
        @Column (name = "dt_pago", nullable=true)
        private Date dataPago;  
        
        @Column (name = "valorPago", nullable=true)
        private float valorPago;        
        
        @ManyToOne(fetch = FetchType.EAGER)
        @JoinColumn(name = "cod_compra", nullable=true)
        @Fetch(FetchMode.JOIN)
        private CompraVO compraVO;      


        public Integer getCodigo() {
                return codigo;
        }

        public void setCodigo(Integer codigo) {
                this.codigo = codigo;
        }

        public Date getDataPago() {
                return dataPago;
        }

        public void setDataPago(Date dataPago) {
                this.dataPago = dataPago;
        }

        public float getValorPago() {
                return valorPago;
        }

        public void setValorPago(float valorPago) {
                this.valorPago = valorPago;
        }

        public CompraVO getCompraVO() {
                return compraVO;
        }

        public void setCompraVO(CompraVO compraVO) {
                this.compraVO = compraVO;
        }


}
